<!DOCTYPE html>
<html>

<head>
  <meta charset="utf-8" />
  <title>{:Lang('title')} - {$config_pub.site_name}</title>
  <meta name="renderer" content="webkit" />
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
  <meta name="viewport"
    content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0" />
  <link rel="stylesheet" href="/layuiadmin/layui/css/layui.css" media="all" />
  <link rel="stylesheet" href="/layuiadmin/style/admin.css?v={:config('other.ui_version')}" media="all" />
</head>

<body class="layui-layout-body">
  <div id="LAY_app">
    <div class="layui-layout layui-layout-admin">
      <div class="layui-header">
        <!-- 头部区域 -->
        <ul class="layui-nav layui-layout-left">
          <li class="layui-nav-item layadmin-flexible" lay-unselect>
            <a href="javascript:;" layadmin-event="flexible" title="侧边伸缩">
              <i class="layui-icon layui-icon-shrink-right" id="LAY_app_flexible"></i>
            </a>
          </li>
          <li class="layui-nav-item layui-hide-xs" lay-unselect>
            <a href="/" target="_blank" title="前台">
              <i class="layui-icon layui-icon-website"></i>
            </a>
          </li>
          <li class="layui-nav-item" lay-unselect>
            <a href="javascript:;" layadmin-event="refresh" title="刷新">
              <i class="layui-icon layui-icon-refresh-3"></i>
            </a>
          </li>
        </ul>
        <div class="msg_notice">
          <dl class="private_chat">
            <dt>
              <i class="layui-icon layui-icon-notice"></i>
              <a id="privateCaht" href="javascript:void(0);">私聊列表</a>
              <span id="privateCount" data-count="0">0</span>
            </dt>
            <!--              <dd id="privateCahtList"></dd>-->
          </dl>

          <!--            <dl>-->
          <!--              <dt>-->
          <!--                <i class="layui-icon layui-icon-notice"></i>-->
          <!--                <a href="javascript:void(0);">待办事项</a>-->
          <!--                <span id="totalCount" data-count="0">0</span>-->
          <!--              </dt>-->
          <!--              <dd>-->
          <!--                <p>-->
          <!--                  <a lay-href="{:url('auth/index')}">主播审核</a>-->
          <!--                  <span id="anchorCount" data-count="0">0</span>-->
          <!--                </p>-->
          <!--                <p>-->
          <!--                  <a lay-href="{:url('user_apply/index')}">信息审核</a>-->
          <!--                  <span id="userApplyCount" data-count="0">0</span>-->
          <!--                </p>-->
          <!--              </dd>-->
          <!--            </dl>-->
        </div>
        <ul class="layui-nav layui-layout-right" lay-filter="layadmin-layout-right">
          <li class="layui-nav-item layui-hide-xs" lay-unselect="">
            <a href="javascript:;" layadmin-event="theme">
              <i class="layui-icon layui-icon-theme"></i>
            </a>
          </li>
          <li class="layui-nav-item" lay-unselect>
            <a href="javascript:;">
              <cite>{$userinfo.name}</cite>
            </a>
            <dl class="layui-nav-child">
              <dd><a lay-href="/admin/login/editpwd">修改密码</a></dd>
              <hr />
              <dd layadmin-event="logout" style="text-align: center">
                <a>退出</a>
              </dd>
            </dl>
          </li>

          <li class="layui-nav-item layui-hide-xs" lay-unselect>
            <a href="javascript:;" layadmin-event=""><i class="layui-icon layui-icon-more-vertical"></i></a>
          </li>
          <li class="layui-nav-item layui-show-xs-inline-block layui-hide-sm" lay-unselect>
            <a href="javascript:;" layadmin-event="more"><i class="layui-icon layui-icon-more-vertical"></i></a>
          </li>
        </ul>
      </div>

      <!-- 侧边菜单 -->
      <div class="layui-side layui-side-menu">
        <div class="layui-side-scroll">
          <div class="layui-logo" lay-href="/admin/index/home">
            <span>{$config_pub.site_name}-{:Lang('title')}</span>
          </div>

          <ul class="layui-nav layui-nav-tree" lay-shrink="all" id="LAY-system-side-menu"
            lay-filter="layadmin-system-side-menu">
            {volist name="menus" key="index" id="menu"}
            <li data-name="home" class="layui-nav-item {if $index == 1}layui-nav-itemed{/if}">
              <a href="javascript:;" lay-tips="{$menu.title}" lay-direction="2">
                <i class="layui-icon {$menu.icon}"></i>
                {if config('other.default_language') =="en" }
                <cite>{$menu.title_en}</cite>
                {else/}
                <cite>{$menu.title}</cite>
                {/if}
              </a>
              <dl class="layui-nav-child">
                {volist name="menu.children" key="children_index"
                id="children"}
                <dd data-name="console" class="{if $index== 1 && $children_index== 1}layui-this {/if}">
                  {if config('other.default_language') =="en" }
                  <a lay-href="{$children.path}">{$children.title_en}</a>
                  {else/}
                  <a lay-href="{$children.path}">{$children.title}</a>
                  {/if}
                </dd>
                {/volist}
              </dl>
            </li>
            {/volist}
          </ul>
        </div>
      </div>

      <!-- 页面标签 -->
      <div class="layadmin-pagetabs" id="LAY_app_tabs">
        <div class="layui-icon layadmin-tabs-control layui-icon-prev" layadmin-event="leftPage"></div>
        <div class="layui-icon layadmin-tabs-control layui-icon-next" layadmin-event="rightPage"></div>
        <div class="layui-icon layadmin-tabs-control layui-icon-down">
          <ul class="layui-nav layadmin-tabs-select" lay-filter="layadmin-pagetabs-nav">
            <li class="layui-nav-item" lay-unselect>
              <a href="javascript:;"></a>
              <dl class="layui-nav-child layui-anim-fadein">
                <dd layadmin-event="closeThisTabs">
                  <a href="javascript:;">关闭当前标签页</a>
                </dd>
                <dd layadmin-event="closeOtherTabs">
                  <a href="javascript:;">关闭其它标签页</a>
                </dd>
                <dd layadmin-event="closeAllTabs">
                  <a href="javascript:;">关闭全部标签页</a>
                </dd>
              </dl>
            </li>
          </ul>
        </div>
        <div class="layui-tab" lay-unauto lay-allowClose="true" lay-filter="layadmin-layout-tabs">
          <ul class="layui-tab-title" id="LAY_app_tabsheader">
            <li lay-id="/admin/index/home" lay-attr="/admin/index/home" class="layui-this">
              <i class="layui-icon layui-icon-home"></i>
            </li>
          </ul>
        </div>
      </div>

      <!-- 主体内容 -->
      <div class="layui-body" id="LAY_app_body">
        <div class="layadmin-tabsbody-item layui-show">
          <iframe src="/admin/index/home" frameborder="0" class="layadmin-iframe"></iframe>
        </div>
      </div>

      <!-- 辅助元素，一般用于移动设备下遮罩 -->
      <div class="layadmin-body-shade" layadmin-event="shade"></div>
    </div>
  </div>

  <script src="/layuiadmin/layui/layui.js"></script>
  <script>
    var play_audio = 0;
    var is_touch = 0;

    layui
      .config({
        base: "/layuiadmin/", //静态资源所在路径
      })
      .extend({
        index: "lib/index", //主入口模块
      })
      .use(["index"], function () {
        var $ = layui.$;

        /**
         * 开始统计
         */
        function startStatis() {
          clearInterval(statis_timer);
          play_audio = 0;
          $.ajax({
            type: "get",
            url: '{:url("index/statisNotice")}',
            dataType: "json",
            data: {},
            //请求成功
            success: function (data) {
              let max_total = 99;
              if (data.code == 0) {
                // 是否播放提示音
                var html = "";
                $.each(data.data, function (i, val) {
                  //console.log("i:", i, "val:", val)

                  if (val > $("#" + i).data("count")) {
                    play_audio = 1;
                  }
                  // html += `<p><a lay-href="{:url('privatechat/chat_info')}?anchor_id=${item.anchor_id}">${item.anchor_id}</a><span data-count="${item.unread}">${item.unread}</span></p>`;
                  $("#privateCaht").attr("lay-href", "/admin/privatechat/chat_info");
                  $("#" + i).data("count", val);
                  $("#" + i).text(val > max_total ? "99+" : val);

                });
                audioStart();
              }
            },
          });
        }

        statis_timer = setInterval(startStatis, 3000);

        setInterval(startStatis, 3000);

        /**
         * 播放音效
         * @returns {boolean}
         */
        function audioStart() {
          if (play_audio != 1) {
            return false;
          }
          var audio_html =
            "<audio id='audioPlay' src='/static/15011.wav' hidden='true' autoplay='autoplay' />";
          $("body").append(audio_html);
          var audio = document.getElementById("audioPlay");
          audio.play();

          setTimeout(function () {
            $("body").find("#audioPlay").remove();
          }, 2000);
        }

        $("body").mouseover(function () {
          if (is_touch > 0) {
            return false;
          }
          is_touch = 1;
          audioStart();
        });
      });
  </script>
</body>

</html>